package net.ktims.khub;


import oracle.webservices.transport.ClientTransport;
import oracle.webservices.OracleStub;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.Stub;

public class IWebServiceEndpoint {
    private IWebService _port;
    
    public IWebServiceEndpoint() throws Exception {
        ServiceFactory factory = ServiceFactory.newInstance();
        _port = ((WebService)factory.loadService(WebService.class)).getIWebServicePort();
    }
    
    /**
     * @param args
     */
    public static void main(String[] args) {
        try {
            IWebServiceEndpoint myPort = new IWebServiceEndpoint();
            System.out.println("calling " + myPort.getEndpoint());
            // Add your own code here
        
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    
    /**
     * delegate all operations to the underlying implementation class.
     */
    
    // invoke_API
    public WsParamSet invoke_API(java.lang.String string_1, java.lang.String string_2, WsParamSet wsParamSet_3) throws java.rmi.RemoteException {
        return _port.invoke_API(string_1, string_2, wsParamSet_3);
    }
    
    
    /**
     * used to access the JAX-RPC level APIs
     * returns the interface of the port instance
     */
    public IWebService getPort() {
        return _port;
    }
    
    public String getEndpoint() {
        return (String) ((Stub) _port)._getProperty(Stub.ENDPOINT_ADDRESS_PROPERTY);
    }
    
    public void setEndpoint(String endpoint) {
        ((Stub) _port)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, endpoint);
    }
    
    public void setMaintainSession(boolean maintainSession) {
        ((Stub) _port)._setProperty(Stub.SESSION_MAINTAIN_PROPERTY, new Boolean(maintainSession));
    }
    
    public boolean getMaintainSession() {
        return ((Boolean) ((Stub) _port)._getProperty(Stub.SESSION_MAINTAIN_PROPERTY)).booleanValue();
    }
    
    /**
     * returns the transport context
     */
    public ClientTransport getClientTransport() {
        return ((OracleStub) _port).getClientTransport();
    }
    
}
